package com.example.qxfw.nyqx.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.ny.CropyieldFcst;
import com.example.qxfw.nyqx.vo.CropYieldFcstListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("service")
public interface CropyieldFcstMapper extends BaseMapper<CropyieldFcst> {
    @Select("select distinct yield " +
            "from cropyield_fcst " +
            "where stationid='${stationId}' and year='${year}' and cropname='${cropName}' and type like '%${type}%'")
    List<String> selectYield(String stationId,long year,String cropName,String type);

    @Select("select distinct yield " +
            "from cropyield_fcst " +
            "where stationid='${stationId}' and year='${year}' and cropname='${cropName}' ")
    List<String> selectYield1(String stationId,long year,String cropName);

    @Select("select year,yield " +
            "from cropyield_fcst " +
            "where year >= '${year1}' and year <= '${year2}' and stationid = '${stationId}' and type like '%${type}%' and cropname='双季晚稻' " +
            "order by year")
    List<CropyieldFcst> selectList1(String year1, String year2, String stationId, String type);


    @Select("select year,yield " +
            "from cropyield_fcst " +
            "where year >= #{year1} and year <= #{year2} and stationid = '${stationId}' and type like '%${type}%'  and cropname = '${cropName}' " +
            "order by year")
    List<CropYieldFcstListVo> listByYear(long year1, long year2, String stationId, String type,String cropName);
}
